package com.steinwurf.hdcjoinwifi;

import ohos.aafwk.content.Intent;
import ohos.wifi.WifiDeviceConfig;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

import java.lang.reflect.Method;

public class MainAbilityTest {
    private MainAbility mainAbility;
    private Intent intent;

    @Before
    public void setUp() throws Exception {
        mainAbility = new MainAbility();
        intent = new Intent();
    }

    @Test
    public void testSSIDFound() {
        mainAbility.SSIDFound();
        Assert.assertNull(mainAbility.mThread);
    }

    @Test
    public void testWifiEnabled() throws Exception {
        mainAbility.wifiEnabled();
        Method updateWifiConfiguration = MainAbility.class.getDeclaredMethod("updateWifiConfiguration", WifiDeviceConfig.class);
        updateWifiConfiguration.setAccessible(true);
        WifiDeviceConfig wfc = new WifiDeviceConfig();
        updateWifiConfiguration.invoke(mainAbility,wfc);
        Assert.assertNotNull(wfc);
    }
}